package com.muye.dianli;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;

import com.muye.constant.C;

/**
 * 基础类
 * 
 * @author TangChao
 * 
 */
public class BaseActivity extends Activity
{
	/**
	 * 点击空白处隐藏键盘
	 */
	@Override
	public boolean onTouchEvent(MotionEvent event)
	{
		try
		{
			InputMethodManager imeMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
			imeMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),
					InputMethodManager.HIDE_NOT_ALWAYS);
		}
		catch (Exception e)
		{
			Log.i(C.TAG, e.toString() + "----->程序无法捕获焦点异常");
		}
		return super.onTouchEvent(event);
	}
}
